package com.liran.entity;

/**
 * @author: whh
 * @Date: 2024/4/22
 * @Description:
 */
public enum ChinaAreaEnum {

    CN_EAST_A("华东A区", "华东A区", 1),
    CN_EAST_B("华东B区", "华东B区", 2),
    CN_MIDDlE("华中大区", "华中大区", 3),
    CN_NORTH("华北大区", "华北大区", 4),
    CN_SOUTH("华南大区", "华南大区", 5),
    CN_WEST("西部大区", "西部大区", 6),
    CN_CREATE("Innovation-Department（创新应用事业部）", "创新应用事业部", 7),
    CN_TECHNICAL("技术支持部", "技术支持部", 8),
    ;

    String areaName;
    String targetAreaName;
    Integer index;

    ChinaAreaEnum(String areaName, String targetAreaName, Integer index) {
        this.areaName = areaName;
        this.targetAreaName = targetAreaName;
        this.index = index;
    }

    public static ChinaAreaEnum getByTargetAreaName(String areaName) {
        for (ChinaAreaEnum chinaAreaEnum : ChinaAreaEnum.values()) {
            if (areaName.equals(chinaAreaEnum.getTargetAreaName())) {
                return chinaAreaEnum;
            }
        }
        return null;
    }

    public static ChinaAreaEnum getByAreaName(String areaName) {
        if(areaName == null){
            return null;
        }
        for (ChinaAreaEnum chinaAreaEnum : ChinaAreaEnum.values()) {
            if (areaName.equals(chinaAreaEnum.getAreaName())) {
                return chinaAreaEnum;
            }
        }
        return null;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public String getTargetAreaName() {
        return targetAreaName;
    }

    public void setTargetAreaName(String targetAreaName) {
        this.targetAreaName = targetAreaName;
    }
}
